﻿using System;
using Abp.Domain.Entities.Auditing;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using FwProject.Authorization.Users;
using FwProject.Core.Restaurant;
using Newtonsoft.Json;

namespace FwProject.Core.SettlementInfoModel
{
    /// <summary>
    /// 结账
    /// </summary>
    [Table("SettlementInfo")]
    public class SettlementInfo : FullAuditedEntity<Guid>
    {


        [Display(Name = "所属工厂")]
        public Guid? FactoryinfoId { get; set; }

        /// <summary>
        /// 收款id
        /// </summary>
        public Guid? ReceiptInfoId { get; set; }
        /// <summary>
        /// 餐厅
        /// </summary>
        /// <value>The restaurantid.</value>

        public Guid? Restaurantid { get; set; }

        [ForeignKey("Restaurantid")]
        public virtual RestaurantInfo RestaurantInfoModel { get; set; }
        /// <summary>
        /// 结账单号
        /// </summary>
        public string CreationNumber { get; set; }
        /// <summary>
        /// 应收金额
        /// </summary>
        /// <value>The totalprice.</value>
        [Required]
        public decimal Totalprice { get; set; } = 0;
        /// <summary>
        /// 制单优惠
        /// </summary>
        /// <value>The discountprice.</value>
        public decimal Discountprice { get; set; } = 0;
        /// <summary>
        /// 实际金额
        /// </summary>
        /// <value>The actualprice.</value>
        [Required]
        public decimal Actualprice { get; set; } = 0;
        /// <summary>
        /// 收款优惠
        /// </summary>
        public decimal ReceivedDiscount { get; set; }
        /// <summary>
        /// 实际收款金额
        /// </summary>
        public decimal ReceivedPrice { get; set; }

        /// <summary>
        /// 使用预收金
        /// </summary>
        public decimal UsePrePayment { get; set; }
        /// <summary>
        /// 财务审核状态
        /// </summary>
        public ExamineStatus ExamineStatus { get; set; } = ExamineStatus.未审核;
        public RestaurantPayStatus RestaurantPayStatus { get; set; } = RestaurantPayStatus.未收款;
        /// <summary>
        /// 收款司机
        /// </summary>
        /// <value>The employee driverid.</value>
        public long? EmployeeDriverid { get; set; }

        [ForeignKey("EmployeeDriverid")]
        public virtual User EmployeeDriverDao { get; set; }
        /// <summary>
        /// 配送时间 2018-01-01-2018--01-31 当月
        /// 2018-01-01 当日
        /// </summary>
        public string DeliveryDate { get; set; }

        #region 20180921
        /// <summary>
        /// 配送开始时间
        /// </summary>
        public DateTime? BeginTime { get; set; }

        /// <summary>
        /// 配送结束时间
        /// </summary>
        public DateTime? EndTime { get; set; }
        #endregion

        /// <summary>
        /// 默认定期结算特殊情况按照日结系统默认自动生成数据。
        /// </summary>
        public BalanceWayEnum BalanceWayEnum { get; set; } = BalanceWayEnum.定期结算;

        /// <summary>
        /// 收据备注
        /// </summary>
        public string RemarksConten { get; set; }

    }
    /// <summary>
    /// 财务审核状态
    /// </summary>
    public enum ExamineStatus
    {
        [Display(Name = "未审核")]
        未审核 = 0,
        [Display(Name = "已审核")]
        已审核 = 1,
        [Display(Name = "已退回")]
        已退回 = 2
    }

    /// <summary>
    /// 收款审核状态
    /// </summary>
    public enum RestaurantPayStatus
    {
        [Display(Name = "未收款")]
        未收款 = 0,
        [Display(Name = "部分收款")]
        部分收款 = 1,
        [Display(Name = "已收完款")]
        已收完款 = 2,
        [Display(Name = "坏账确认")]
        坏账确认=3,
        [Display(Name = "作废")]
        作废 = 4,
       
      
    }
}
